home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ARexxTools / ButtonBar_v10.lha / pscrfnt2.lha / psf2 / PubScreenFont.c next >
Encoding:
C/C++ Source or Header  |  1993-12-05  |  1.8 KB  |  99 lines

  1. /*
  2.  *    PubScreenFont.c -- tell font used by a [named] public screen
  3.  *
  4.  *    Michael Groshart -- Island Earth Software
  5.  */
  6.  
  7. static char version[] = "$VER: PubScreenFont 1.1 (5.12.93)";
  8.  
  9. #include <clib/dos_protos.h>
  10. #include <clib/exec_protos.h>
  11. #include <clib/graphics_protos.h>
  12. #include <clib/intuition_protos.h>
  13.  
  14. #include <pragmas/dos_lib.h>
  15. #include <pragmas/exec_lib.h>
  16. #include <pragmas/graphics_lib.h>
  17. #include <pragmas/intuition_lib.h>
  18.  
  19. #ifdef AZTEC_C
  20. void _wb_parse(void) {}
  21. void _cli_parse(void) {}
  22. #endif
  23.  
  24. /*
  25.  *    print value(s) of font bits
  26.  */
  27.  
  28. struct FontBits
  29. {
  30.     UBYTE value,*text;
  31. }
  32. style[] =
  33. {
  34.     { FSF_UNDERLINED  ," underlined"   },
  35.     { FSF_BOLD        ," bold"         },
  36.     { FSF_ITALIC      ," italic"       },
  37.     { FSF_EXTENDED    ," extended"     },
  38.     { FSF_COLORFONT   ," colorfont"    },
  39. },
  40. flags[] =
  41. {
  42.     { FPF_REVPATH     ," revpath"      },
  43.     { FPF_TALLDOT     ," talldot"      },
  44.     { FPF_WIDEDOT     ," widedot"      },
  45.     { FPF_PROPORTIONAL," proportional" },
  46.     { FPF_DESIGNED    ," designed"     },
  47. };
  48.  
  49. void lookup(struct FontBits *table,UBYTE mask)
  50. {
  51.     WORD i;
  52.  
  53.     for (i = 0 ; i < 5 ; ++i)
  54.     {
  55.         if (table[i].value & mask)
  56.         {
  57.             PutStr(table[i].text);
  58.         }
  59.     }
  60. }
  61.  
  62. /*
  63.  *    entry point, pretty simple really
  64.  */
  65.  
  66. long args[1],rc = RETURN_ERROR;    /* presume failure */
  67.  
  68. main(void)
  69. {
  70.     struct Library    *IntuitionBase;
  71.     struct RDArgs    *rda;
  72.     struct Screen    *screen;
  73.     struct TextFont    *font;
  74.  
  75.     if (IntuitionBase = OpenLibrary("intuition.library",36L))
  76.     {
  77.         if (rda = ReadArgs("PUBSCREEN",args,NULL))
  78.         {
  79.             if (screen = LockPubScreen((char *) args[0]))
  80.             {
  81.                 rc = RETURN_OK;
  82.                 font = screen->RastPort.Font;
  83.  
  84.                 Printf("%s %d %d",font->tf_Message.mn_Node.ln_Name,font->tf_YSize,font->tf_XSize);
  85.  
  86.                 lookup(style,font->tf_Style);
  87.                 lookup(flags,font->tf_Flags);
  88.  
  89.                 PutStr("\n");
  90.  
  91.                 UnlockPubScreen(NULL,screen);
  92.             }
  93.             FreeArgs(rda);
  94.         }
  95.         CloseLibrary(IntuitionBase);
  96.     }
  97.     return rc;
  98. }
  99.